Skip to content

Conversation

sjpb
Copy link
Collaborator

@sjpb sjpb commented Jan 9, 2025

Adds an extra_volumes property to the tofu compute mapping to allow defining volumes which OpenTofu will create and attach to compute nodes. Useful for simulating additional disks present in baremetal instances using virtualized instances.

Note that:

  • Unlike the default home and state volumes attached to the control node, compute volumes defined this way are not automatically formatted or mounted.
  • Volumes are attached after instance creation and the path under /dev/{v,s}d* may not reflect the ordering in the extra_volumes property and may change across reboots. Use e.g. /dev/disk/by-path/ for mounts etc.
  • As long as volume-backed compute instances are not used, OpenTofu will update instances in place (i.e. reimage) to change the node image, even with extra_volumes specified.

@sjpb sjpb requested a review from a team as a code owner January 9, 2025 14:00
@sjpb
Copy link
Collaborator Author

sjpb commented Jan 9, 2025

Replaces #452 which undesirably deleted the ability to create volume-backed compute instances.

Tested that:

  • With 2x volumes of different sizes (to allow distinguishing), volumes are correctly created, attached, and visible via lsblk.
  • When changing the cluster_image, the opentofu plan showed "update in place" for these compute instances.

Copy link
Contributor

@wtripp180901 wtripp180901 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@sjpb sjpb merged commit a7876a6 into main Jan 9, 2025
2 checks passed
@sjpb sjpb deleted the feat/compute-vols-v2 branch January 9, 2025 14:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants